#include <vector>
#include <iostream>

using namespace std;

int r[25];
int c[25];
int n;

int N[][2] = { {-1, 0}, {0, 1}, {1, 0}, {0, -1} };
vector<int> rount;


bool vis[25 * 25];


void dfs(int x, int y)
{
	--r[x], --c[y];
	int cur = y * n + x;
	vis[cur] = true;
	rount.push_back(cur);
	if (cur ==n*n-1)
	{
		for (int i = 0; i < n; i++)
		{
			if (r[i] != 0 || c[i] != 0) return;
		}

		for (auto e : rount)cout << e << ' ';
		exit(0);
	}

	for (auto &d:N)
	{
		int nx = d[0] + x, ny =d[1] + y;
		int Next = ny * n + nx;
		if (nx < 0 || nx >= n || ny < 0 || ny >= n ||
			vis[Next] || r[nx] <= 0 || c[ny] <= 0) continue;

		dfs(nx, ny);
		vis[Next] = false;
		rount.pop_back();
		++r[nx], ++c[ny];
	}
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)cin >> r[i];
	for (int i = 0; i < n; i++)cin >> c[i];
	dfs(0, 0);
	return 0;
}